streamlit コマンド
setup.pyのentry_pointsを確認
streamlit.cli:main
Click製 (7系)
Flask 2.0 で Click 8.0 もリリースされたはず
サブコマンド run (streamlit run)
引数 target
ローカルのPythonスクリプト
URLにも対応(GitHubなど)
一時ファイルとしてダウンロードして動かす
→ ファイルのURLを指定したら共有・再現できるということ!
サブコマンド docs
ブラウザで https://docs.streamlit.io を開く
_main_run(file, args=None, flag_options=None)
helloサブコマンドでも呼び出している
fileはファイルパス
bootstrap.runを呼び出す streamlit.bootstrap
_main_run で呼び出す _get_command_line_as_string
click.get_current_context()
https://click.palletsprojects.com/en/7.x/advanced/#global-context-access
parent contextを取得 (Noneのときもある)
https://click.palletsprojects.com/en/7.x/api/#click.Context
_get_command_line_as_string で呼び出す subprocess.list2cmdline
https://stackoverflow.com/a/12130261
1つにつなげた文字列を返す